Skip to content

chore: observability audit fixes and documentation updates - #41

Merged
kacy merged 1 commit into
mainfrom
chore/observability-audit
Feb 7, 2026
Merged

chore: observability audit fixes and documentation updates#41
kacy merged 1 commit into
mainfrom
chore/observability-audit

Conversation

@kacy

@kacy kacy commented Feb 6, 2026

Copy link
Copy Markdown
Owner

summary

  • fixes connected_clients in INFO to report active connections instead of total accepted (was a monotonically increasing counter, now tracks live connections)
  • adds connections_active atomic counter to ServerContext, incremented on accept and decremented on handler exit
  • moves metrics_enabled into ServerContext to reduce parameter threading through handle() and process()
  • gates Instant::now() behind a metrics_enabled || slowlog.is_enabled() check so there's zero timing overhead when both are disabled
  • replaces .expect("slowlog lock poisoned") on all 4 mutex acquisitions in SlowLog with graceful poison recovery (clears entries and continues rather than crashing the server)
  • updates README, Dockerfile, crate READMEs, and CLAUDE.md to reflect observability features

tested

  • cargo clippy --workspace -- -D warnings — clean
  • cargo test --workspace — all 579 tests pass
  • reviewed all 4 mutex sites in slowlog.rs for consistent poison handling
  • verified INFO CLIENTS section now reads connections_active instead of connections_accepted

design considerations

  • poison recovery in SlowLog clears entries on the write path (maybe_record) but preserves them on read paths (get, len). the slow log is best-effort observability — losing entries after a panic is acceptable, crashing the server is not.
  • is_enabled() on SlowLog reads config.enabled which is set at construction time and never changes, so no synchronization needed.
  • timing gate uses Option<Instant> instead of a separate code path to keep the logic simple and avoid duplication.

- fix connected_clients in INFO to show active connections (not total)
- add connections_active atomic counter to ServerContext
- move metrics_enabled into ServerContext, remove parameter threading
- gate Instant::now() behind metrics/slowlog check to avoid overhead
- replace .expect() on slowlog mutex with graceful poison recovery
- add SlowLog::is_enabled() for fast enablement checks
- update README with observability features, new CLI flags, status
- update Dockerfile to expose metrics port 9100
- update crate READMEs (ember-server, ember-protocol)
- mark Phase 5 Week 15 items complete in CLAUDE.md
@kacy
kacy merged commit 3706f08 into main Feb 7, 2026
4 of 5 checks passed
@kacy
kacy deleted the chore/observability-audit branch February 7, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant